/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * view_member.java
 *
 * Created on Nov 5, 2012, 8:00:31 AM
 */
package com.view;

import com.model.Member;
import com.rekap.*;
import java.sql.*;
import java.util.List;
import java.util.logging.*;
import javax.swing.JOptionPane;

/**
 *
 * @author ryulong
 */
public class view_member extends javax.swing.JFrame {

    /** Creates new form view_member */
    public view_member() {
        initComponents();
        tampilMember();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        file = new javax.swing.JMenu();
        home = new javax.swing.JMenuItem();
        exit = new javax.swing.JMenu();
        menuEdit = new javax.swing.JMenu();
        order = new javax.swing.JMenuItem();
        lihatPesanan = new javax.swing.JMenuItem();
        paket = new javax.swing.JMenu();
        lihatDaftarPaket = new javax.swing.JMenuItem();
        tambahPaket = new javax.swing.JMenuItem();
        member = new javax.swing.JMenu();
        lihatMember = new javax.swing.JMenuItem();
        tambahMember = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jScrollPane1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "ID", "Nama", "Alamat", "No Telp"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 110, 510, 141));

        jButton1.setText("Tambah");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 320, -1, -1));

        jButton5.setText("Update");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 320, -1, -1));

        jButton3.setText("Keluar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 320, -1, -1));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/images/background.jpg"))); // NOI18N
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 510, 380));

        file.setText("File");

        home.setText("Home");
        home.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                homeActionPerformed(evt);
            }
        });
        file.add(home);

        exit.setText("Exit");
        exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitActionPerformed(evt);
            }
        });
        file.add(exit);

        jMenuBar1.add(file);

        menuEdit.setText("Pesanan");
        menuEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuEditActionPerformed(evt);
            }
        });

        order.setText("order");
        order.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                orderActionPerformed(evt);
            }
        });
        menuEdit.add(order);

        lihatPesanan.setText("lihat pesanan");
        lihatPesanan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatPesananActionPerformed(evt);
            }
        });
        menuEdit.add(lihatPesanan);

        jMenuBar1.add(menuEdit);

        paket.setText("Paket");

        lihatDaftarPaket.setText("lihat daftar Paket");
        lihatDaftarPaket.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatDaftarPaketActionPerformed(evt);
            }
        });
        paket.add(lihatDaftarPaket);

        tambahPaket.setText("tambah Paket");
        tambahPaket.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tambahPaketActionPerformed(evt);
            }
        });
        paket.add(tambahPaket);

        jMenuBar1.add(paket);

        member.setText("Member");

        lihatMember.setText("lihat Member");
        lihatMember.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatMemberActionPerformed(evt);
            }
        });
        member.add(lihatMember);

        tambahMember.setText("tambah Member");
        member.add(tambahMember);

        jMenuBar1.add(member);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
Registrasi reg = new Registrasi ();
reg.setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
this.dispose();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
tampilMember();
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton5ActionPerformed

    private void homeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_homeActionPerformed
        FromMenuOperator home = new FromMenuOperator();
        home.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_homeActionPerformed

    private void exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitActionPerformed
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_exitActionPerformed

    private void orderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderActionPerformed
        FormPesanan pesan = new FormPesanan();
        pesan.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_orderActionPerformed

    private void lihatPesananActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatPesananActionPerformed
        view_pesanan viewp = new view_pesanan();
        viewp.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_lihatPesananActionPerformed

    private void menuEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuEditActionPerformed
        FormPesanan edit = new FormPesanan();
        edit.setVisible(true);
        this.dispose();// TODO add your handling code here:
    }//GEN-LAST:event_menuEditActionPerformed

    private void lihatDaftarPaketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatDaftarPaketActionPerformed
        view_menu viewm = new view_menu();
        viewm.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_lihatDaftarPaketActionPerformed

    private void tambahPaketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahPaketActionPerformed
        FormMenuTambah addMenu = new FormMenuTambah();
        addMenu.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_tambahPaketActionPerformed

    private void lihatMemberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatMemberActionPerformed
        view_member viewber = new view_member();
        viewber.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_lihatMemberActionPerformed

    private void tampilMember (){
        try{
            List <Member> kategoris =
            TableKontrol.getKoneksiKategori().lihatSeluruhKategori();
            TableModel model = new TableModel(kategoris);
            jTable1.setModel(model);
           } catch (SQLException ex){
                   Logger.getLogger(view_member.class.getName()).log(Level.SEVERE,null,ex);
    }
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new view_member().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu exit;
    private javax.swing.JMenu file;
    private javax.swing.JMenuItem home;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JMenuItem lihatDaftarPaket;
    private javax.swing.JMenuItem lihatMember;
    private javax.swing.JMenuItem lihatPesanan;
    private javax.swing.JMenu member;
    private javax.swing.JMenu menuEdit;
    private javax.swing.JMenuItem order;
    private javax.swing.JMenu paket;
    private javax.swing.JMenuItem tambahMember;
    private javax.swing.JMenuItem tambahPaket;
    // End of variables declaration//GEN-END:variables
}
